package com.yt.lxh.dto.activity.coupon;

import com.yt.lxh.enums.CouponRangeType;
import com.yt.lxh.enums.CouponType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.math.BigDecimal;

@Data
@ApiModel(description = "修改优惠券")
public class UpdateCouponDTO {

    @ApiModelProperty(value = "优惠券ID", required = true)
    private String id;

    @ApiModelProperty(value = "优惠券类型 0(无门槛) 1(满减) 2(每满减) 3(折扣)", required = true)
    private CouponType couponType = CouponType.NO_CONDITION;

    @ApiModelProperty(value = "优惠券名称", required = true)
    @NotBlank(message = "优惠券名称不能为空")
    @Size(min = 2, max = 20, message = "优惠券名称长度在2-20之间")
    private String couponName;

    @ApiModelProperty(value = "优惠金额", required = true)
    @NotNull(message = "优惠门槛不能为空")
    @Digits(integer = 1000, fraction = 2, message = "优惠门槛格式不正确")
    @DecimalMin(value = "0.01", message = "优惠门槛不能小于0.01")
    private BigDecimal amount;

    @ApiModelProperty(value = "优惠门槛：满减/每满减(填抵扣金额门槛) 折扣(比如8折填80) 无门槛填0", required = true)
    @NotNull(message = "优惠门槛不能为空")
    @Digits(integer = 1000, fraction = 2, message = "优惠门槛格式不正确")
    @DecimalMin(value = "0.00", message = "优惠门槛不能小于0")
    private BigDecimal conditionAmount;

    @ApiModelProperty(value = "使用范围 0(全场通用) 1(指定分类) 2(指定商品)")
    private CouponRangeType rangeType;

    @ApiModelProperty(value = "范围业务id")
    private String rangeId;

    @ApiModelProperty(value = "使用范围描述")
    private String rangeDesc;

    @ApiModelProperty(value = "发行数量")
    @NotNull(message = "发行数量不能为空")
    @Range(min = 1, max = 10000, message = "发行数量在1-10000之间")
    private Integer publishCount;

    @ApiModelProperty(value = "每人限领张数")
    @NotNull(message = "每人限领张数不能为空")
    @Range(min = 1, max = 10, message = "每人限领张数在1-10之间")
    private Integer perLimit;

}
